package things
{
	import UI.abstract.component.control.mc.Animation;
	import UI.abstract.resources.AnCategory;
	
	import things.data.ThingData;
	import things.data.UsData;

	public class User extends Animal
	{
		protected var _weaponAn:AnimationData;	//武器
		protected var _bodyHat:AnimationData;	//帽子
		protected var _mounts:AnimationData;
		public function User()
		{
			super();
		}
		override public function create(data:ThingData):void
		{
			super.create(data);
			
			updateEquips();
		}
		public function get usData():UsData
		{
			return _data as UsData;
		}
		override public function dispose():void
		{
			_weaponAn = null;
			_bodyHat = null;
			_mounts = null;
			super.dispose();
		}
		public function updateEquips():void
		{
			changeEquips();
		}
		private function changeEquips():void
		{
			if(usData.equips[0] > 0){
				
			}else{
				
			}
			if(usData.equips[1] == 0){
				if(!_weaponAn){
					_weaponAn = new AnimationData(AnCategory.USER,"100022002_12");
					_anSetting.addChild(_weaponAn);
				}
			}else{
				if(_weaponAn){
					_weaponAn.dispose();
					_weaponAn = null;
				}
			}
			if(usData.equips[2] > 0){
				if(!_bodyHat){
					_bodyHat = new AnimationData();
					_anSetting.addChild(_bodyHat);
				}
			}else{
				if(_bodyHat){
					_bodyHat.dispose();
					_bodyHat = null;
				}
			}
		}
		public function rideOnMounts():void
		{
			if(!_mounts){
				_mounts = new AnimationData();
				_anSetting.addChild(_mounts);
			}
		}
		public function jumpDownMounts():void
		{
			_mounts.dispose();
			_mounts = null;
		}
	}
}